//
//  NetHelp.m
//  MINFOBBS
//
//  Created by juvid on 13-12-6.
//  Copyright (c) 2013年 minfo. All rights reserved.
//

#import "NetHelp.h"
#import "MainSearchViewController.h"
#import "UIColor+expanded.h"
#import "WebController.h"
#import "MFSideMenuContainerViewController.h"
@interface NetHelp ()

@end

@implementation NetHelp

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.view.backgroundColor=[UIColor clearColor];
    self.vieHead.layer.cornerRadius=8;
//    [self.vieHead.layer setMasksToBounds:YES];
    self.table.separatorStyle=UITableViewCellSeparatorStyleNone;
    // Do any additional setup after loading the view from its nib.
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 2;
}

- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    static NSString *CellIdentifier=@"CellIdentifier";
    UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if(cell==nil){
        cell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
        cell.selectionStyle=UITableViewCellSelectionStyleGray;
    }
    NSArray *arr=[[NSArray alloc]initWithObjects:@"互联网搜索",@"使用帮助", nil];
    cell.textLabel.text=[arr objectAtIndex:indexPath.row];
    cell.textLabel.font=[UIFont systemFontOfSize:14];
    cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
    cell.imageView.image=[UIImage imageNamed:[arr objectAtIndex:indexPath.row]];
    if (indexPath.row==0) {
        UILabel *labLine=[[UILabel alloc]initWithFrame:CGRectMake(0, 43, self.table.frame.size.width, 1)];
        labLine.backgroundColor=[UIColor colorWithHexString:@"0xf3f3f3"];
        [cell.contentView addSubview:labLine];
        
    }
    return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    if (indexPath.row==0) {
        WebController *webCon=[[WebController alloc]init];
        webCon.requestUrl= [NSURLRequest requestWithURL:[NSURL URLWithString:[[NSString stringWithFormat:@"http://www.baidu.com/s?wd=%@",self.strQuery] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];
        [self.navigationController pushViewController:webCon animated:YES];
    }
    else{
        [self.menuContainerViewController toggleRightSideMenuCompletion:^{
           
        }];
    }
}


- (MFSideMenuContainerViewController *)menuContainerViewController {
    return (MFSideMenuContainerViewController *)self.navigationController.parentViewController;
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
